package cn.momoshenchi.medicine.controller;

import cn.momoshenchi.medicine.pojo.BaseAccout;
import cn.momoshenchi.medicine.pojo.ConsultAsk;
import cn.momoshenchi.medicine.service.BaseAccoutService;
import cn.momoshenchi.medicine.service.ConsultAskService;
import cn.momoshenchi.medicine.util.AssertUtil;
import cn.momoshenchi.medicine.util.ResultInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @version : 1.0
 * @author: momoshenchi
 * @date: 2021/7/13 - 10:39
 */
@RestController()
@RequestMapping("/user")
public class UserController
{

    @Autowired
    private BaseAccoutService baseAccoutService;

    @Autowired
    private ConsultAskService consultAskService;


    /**
     * 用户第一次登录
     * @param baseAccout
     */
    @PostMapping("/login")
    public  ResultInfo login(   @RequestBody @Valid  BaseAccout baseAccout)
    {
        BaseAccout accout = baseAccoutService.getById(baseAccout.getUserId());
        if(accout==null)
        {
            baseAccout.setUserType("1");
            baseAccoutService.login(baseAccout);
        }
        return new ResultInfo();
    }

}
